/**
 * 
 */
package kevin.study.zephyr.domain.model.view;

import java.util.ArrayList;
import java.util.Collection;

import kevin.study.zephyr.domain.model.Document;
import kevin.study.zephyr.domain.model.Field;
import kevin.study.zephyr.domain.model.Item;


/**
 * 以列为单位获取数据
 * 
 * @author Kevin.Huang
 * @createtime 2007-10-9
 */
public class ColumnEntity {

	private Field columnField;

	private Collection< Collection< Object > > values;

	public ColumnEntity(Collection< Document > documents, Field field) {
		super();
		this.columnField = field;
		this.values = new ArrayList< Collection< Object > >();
		for (Document doc : documents) {
			Collection< Item > items = doc.getItemsByName(field.getName());
			for (Item i : items) {
				if (i.getField().equals(field)) {
					this.values.add(i.getValues());
				}
			}
		}
	}

	/**
	 * @return the values
	 */
	public Collection< Collection< Object >> getValues() {
		return values;
	}

	/**
	 * @return the columnField
	 */
	public Field getColumnField() {
		return columnField;
	}

}
